<html>
	<head>
		<title>注册</title>
		<meta charset="utf-8">
		<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
	</head>
	<body>
		<h1>注册</h1>
		用户名：<input type="text" id="username"/><br>
		密码：<input type="password" id="password"/><br>
		姓名：<input type="text" id="name"/><br>
		年龄：<input type="text" id="age"/><br>
		性别：<input type="text" id="gender"/><br>
		电子邮箱：<input type="text" id="email"/><br>
		QQ：<input type="text" id="qq"/><br>
		微信：<input type="text" id="wechat"/><br>
		电话：<input type="text" id="phone"/><br>
		<button type="button" onclick="sub()">注册</button>
	</body>
	<script type="text/javascript">
		function sub(){
			var username = $("#username").val();
			var password = $("#password").val();
			var name = $("#name").val();
			var age = $("#age").val();
			var gender = $("#gender").val();
			var email = $("#email").val();
			var qq = $("#qq").val();
			var wechat = $("#wechat").val();
			var phone = $("#phone").val();
			$.post('student/register', {
				username: username,
				password: password,
				name: name,
				level: new Date().getFullYear(),
				age: age,
				gender: gender,
				email: email,
				qq: qq,
				wechat: wechat,
				phone: phone
			}, function(res){
				if(res.code == "00000"){
					window.location.href = "index";
				}else{
					alert(res.message);
				}
			}, "json")
		}
	</script>
</html>